﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace PlaceOrder_Client.Converters
{
    public class TradeStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value==null)
            {
                return null;
            }

            int status = (int)value;
            switch (status)
            {
                case 0:
                    return "待接收";
                case 1:
                    return "已接收";
                case 2:
                    return "已拒绝";
                case 3:
                    return "已成交";
                case 4:
                    return "部分成交";
                case 5:
                    return "已撤单";
                case 6:
                    return "部分撤单";
                case 7:
                    return "撤单待确认";
                case 8:
                    return "已拒撤";
                case 9:
                    return "成交待确认";
                case 10:
                    return "子询价单确认中";
                case 11:
                    return "待平仓";
                case 12:
                    return "已平仓";
                case 13:
                    return "作废";
                case 16:
                    return "已平修改中";
                case 17:
                    return "未平修改中";
                case 19:
                    return "难成待确认";
                case 20:
                    return "续作待确认";
                case 21:
                    return "交易单已结束";
                case 22:
                    return "交易单已关闭";
                case 23:
                    return "询价单修改中";
                default:
                    return "未知状态";
            }

        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}
